home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / SciAn / src / ScianDatasets.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  8KB  |  212 lines

  1. /*ScianDatasets.h
  2.   Eric Pepke
  3.   August 17, 1990
  4.   External stuff for Datasets window
  5. */
  6.  
  7. extern ObjPtr data3DScalar, data2DScalar, data1DVector, data3DUnstructSurface;
  8. extern ObjPtr dataFormClass, datasetClass, filterClass;
  9. extern ObjPtr geometryClass;            /*Class for geometry object*/
  10. extern ObjPtr globalDataset;
  11.  
  12. extern ObjPtr iconDataset;
  13. extern ObjPtr icon1DVector, icon2DVector, icon3DVector, icon4DVector;
  14. extern ObjPtr icon1DScalar, icon2DScalar, icon3DScalar, icon4DScalar;
  15.  
  16. extern Bool onePalette;
  17.  
  18. /*Is dataset predicate*/
  19. #define IsDataset(object) IntVarEql(object, CLASSID, CLASS_DATASET)
  20.  
  21.  
  22. /*Flags for dataset info*/
  23. #define DS_HASFORM        1    /*Dataset has a dataform*/
  24. #define DS_HASFIELD        2    /*Dataset has a field*/
  25. #define DS_HASGEOMETRY        4    /*Dataset has geometry*/
  26. #define DS_UNSTRUCTURED        8    /*The data form is unstructured*/
  27. #define DS_TIMEDEPENDENT    16    /*Dataset is time-dependent*/
  28. #define DS_VECTOR        32    /*Field is a vector field, not scalar*/
  29. #define DS_HASNEWGEOMETRY    64    /*Has new geometry*/
  30.  
  31. #define FORMFIELD        0    /*Default number for a data form dataset*/
  32. #define FIELD1            1
  33. #define FIELD2            2
  34. #define FIELD3            3
  35. #define FIELD4            4
  36. #define DEFORMFIELD        5    /*Field for deformation*/
  37. #define DEFORMFORM        6    /*Form for deformation*/
  38. #define FIELD5            7
  39. #define MAXNCURFIELDS        9    /*Maximum number of current fields*/
  40.  
  41. /*Component flags*/
  42. #define CF_MONOTONIC        1    /*Component is monotonic*/
  43. #define CF_NOTMONOTONIC        2    /*Component is not monotonic*/
  44.  
  45. #define MAXBUCKETSIZE        10000    /*Maximum size of bucket array*/
  46. #define BUCKETSIZEFACTOR    1    /*Factor of bucket size vs. data size*/
  47. #define ADDBUCKETS        5    /*Number of buckets to add when needed*/
  48.  
  49. typedef real TwoReals[2];
  50.  
  51. typedef struct
  52.     {
  53.     int nIndices;        /*Number of sets of indices*/
  54.     long *indices;        /*Pointer to array of indices*/
  55.     real *samples;        /*Sample at a given index*/
  56.     } Bucket;
  57.  
  58. typedef struct
  59.     {
  60.     union
  61.     {
  62.         real *unComp;    /*Pointer to uncompressed data*/
  63.         unsigned char *comp;/*Pointer to compressed data*/
  64.     } data;
  65.  
  66.     Bool dataCompressed;    /*True iff data is compressed*/
  67.     real cTable[256];    /*Compression table*/
  68.     long dataSize;        /*Length of data, used for comparison*/
  69.     int nIndices;        /*Number of topological indices*/
  70.     int *indices;        /*Numbers of the indices required*/
  71.     long *dimensions;    /*Dimensions of the component*/
  72.     long *steps;        /*Steps into the indices*/
  73.     int flags;        /*Flags for the component*/
  74.     } Component;
  75.  
  76. typedef struct
  77.     {
  78.     int topDim;        /*Topological dimension of this field*/
  79.     int nComponents;    /*Number of components of this field*/
  80.     Component *components;    /*Components in the field*/
  81.     ObjPtr fieldObj;    /*Field obj for quick comparison later*/
  82.     Bool idiotFlag;        /*Idiot flag for quick access of plain datasets*/
  83.     int nBucketIndices;    /*# of indices per bucket, raw (not indirect)*/
  84.     long *bucketDim;    /*The size of each bucket dimension.  0 == missing dimension!*/
  85.     TwoReals *bucketMinMax;    /*The array of min and max values for each component*/
  86.     Bucket *buckets;    /*Buckets for backward search, as many dims as nComponents*/
  87.     Bool substMissing;    /*Substitute missing data*/
  88.     real missingVal;    /*Value to subsitute for missing data*/
  89.     Bool groupInterp;    /*True iff this is group interpolation*/
  90.     real weight;         /*Weight of this sample, if we need to interp*/
  91.     ObjPtr objectInfo;    /*Other info in object form*/
  92.     } DatasetBuffer;
  93.  
  94. extern Bool timedDatasets;    /*Flag for timed datasets*/
  95. extern DatasetBuffer curFields[MAXNCURFIELDS * 2];
  96.  
  97. #define SELECTFIELDCOMPONENT(whichField, whichComponent, indices)    \
  98.     (curFields[whichField] . idiotFlag ?                \
  99.     curFields[whichField] . components[whichComponent] . data . unComp[*(indices)] :\
  100.     SelectFieldComponent(whichField, whichComponent, indices))
  101.  
  102. ObjPtr VisualizeDatasetAs();
  103.  
  104. #define NewStructuredDataset(a, b, c, d) NewDataset(a, b, c, d)
  105.  
  106. #ifdef PROTO
  107. ObjPtr NewGeometryDataset(char *name);
  108. WinInfoPtr NewDatasetsWindow(void);
  109. void InitDataSets(void);
  110. void KillDataSets(void);
  111. Bool RegisterComponent(int, int, ObjPtr);
  112. real GetClosest3Sample(real x, real y, real z);
  113. Bool RegisterDataset(ObjPtr);
  114. Bool RegisterNewDataset(ObjPtr dataset);
  115. int GetTopDim(ObjPtr);
  116. long GetDatasetInfo(ObjPtr);
  117. int GetSpatialDim(ObjPtr);
  118. ObjPtr GetDatasetKEdges(ObjPtr, int);
  119. ObjPtr GetDatasetFormBounds(ObjPtr);
  120. ObjPtr GetDatasetFormDims(ObjPtr);
  121. void ReportFileFormatError(void);
  122. WinInfoPtr DatasetsWindow(void);
  123. Bool SetCurField(int, ObjPtr);
  124. Bool SetCurForm(int, ObjPtr);
  125. real SelectFieldComponent(int, int, long *);
  126. real SelectFieldScalar(int, long *);
  127. real InterpolateFieldComponent(int, int, real *);
  128. real InterpolateFieldScalar(int, real *);
  129. long GetComponentOffset(int, int, long indices[]);
  130. void PutFieldComponent(int, int, long *, real);
  131. void PutCompressedFieldComponent(int, int, long *, unsigned char);
  132. void StuffIJPlane(real *dest, int whichField, int whichComponent, long indices[]);
  133. void DatasetChanged(ObjPtr);
  134. int GetNComponents(int);
  135. int CountComponentDims(int, int);
  136. long *GetComponentDims(int, int);
  137. Bool FindClosestSample(int, int, long indices[], int, real sample[]);
  138. Bool SampleToTopIndex(int, int, real indices[], int, real sample[]);
  139. Bool SampleSpatComponent(int, int, int, real resultComp[], int, real spatIndices[], Bool);
  140. real SampleSpatScalar(int, int, int, real spatIndices[], Bool);
  141. ObjPtr GetLongName(ObjPtr);
  142. ObjPtr NewDataset(char *name, int rank, long *dims, int nComponents);
  143. ObjPtr NewCompressedDataset(char *name, int rank, long *dims, int nComponents, real cTable[256]);
  144. ObjPtr NewSeparableDataForm(char *name, int rank, long *dims, real *scales[]);
  145. void SetDatasetForm(ObjPtr dataset, ObjPtr dataForm);
  146. void SetDatasetPalette(ObjPtr dataset, ObjPtr palette);
  147. ObjPtr NewRegularDataForm(char *name, int rank, long *dims, real *bounds);
  148. ObjPtr NewCurvilinearDataForm(char *name, int rank, long *dims, real *bounds, ObjPtr dataset);
  149. ObjPtr NewUnstructuredDataForm(char *name, int rank, long *dims, real *bounds, ObjPtr dataset);
  150. Bool InsertDatasetTimeStep(ObjPtr masterDataset, ObjPtr timeSlice, real tm);
  151. Bool RegisterTimeDataset(ObjPtr dataset, real tm);
  152. void SetDatasetTimeFormat(ObjPtr dataset, int format);
  153. int CountTraversalDims(int whichField);
  154. void GetTraversalDims(int whichField, long dims[]);
  155. Bool IdenticalFields(int, int);
  156. void SetAllDatasetTimes(real);
  157. ObjPtr FindDatasetByName(char *);
  158. void Put1Edge(ObjPtr dataForm, long edge, long v1, long v2);
  159. #else
  160. ObjPtr NewGeometryDataset();
  161. WinInfoPtr NewDatasetsWindow();
  162. void InitDataSets();
  163. void KillDataSets();
  164. Bool RegisterComponent();
  165. real GetClosest3Sample();
  166. Bool RegisterDataset();
  167. Bool RegisterNewDataset();
  168. long GetDatasetInfo();
  169. ObjPtr GetDatasetKEdges();
  170. ObjPtr GetDatasetFormBounds();
  171. ObjPtr GetDatasetFormDims();
  172. void ReportFileFormatError();
  173. WinInfoPtr DatasetsWindow();
  174. Bool SetCurField();
  175. Bool SetCurForm();
  176. real SelectFieldComponent();
  177. real SelectFieldScalar();
  178. real InterpolateFieldComponent();
  179. real InterpolateFieldScalar();
  180. long GetComponentOffset();
  181. void StuffScalarIJSquare();
  182. void StuffIJPlane();
  183. void PutFieldComponent();
  184. void PutCompressedFieldComponent();
  185. void DatasetChanged();
  186. int GetNComponents();
  187. int CountComponentDims();
  188. long *GetComponentDims();
  189. int GetDatasetSpatialDim();
  190. Bool FindClosestSample();
  191. Bool SampleSpatComponent();
  192. real SampleSpatScalar();
  193. ObjPtr GetLongName();
  194. ObjPtr NewDataset();
  195. ObjPtr NewCompressedDataset();
  196. ObjPtr NewSeparableDataForm();
  197. ObjPtr SetDatasetForm();
  198. void SetDatasetPalette();
  199. ObjPtr NewRegularDataForm();
  200. ObjPtr NewCurvilinearDataForm();
  201. ObjPtr NewUnstructuredDataForm();
  202. Bool InsertDatasetTimeStep();
  203. Bool RegisterTimeDataset();
  204. void SetDatasetTimeFormat();
  205. int CountTraversalDims();
  206. void GetTraversalDims();
  207. Bool IdenticalFields();
  208. void SetAllDatasetTimes();
  209. ObjPtr FindDatasetByName();
  210. void Put1Edge();
  211. #endif
  212.